.\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu)
.\" May be distributed under the GNU General Public License
.\" Changes from sct@dcs.ed.ac.uk added Sat Oct  9 09:54:00 1993.
.TH RDEV 8 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual"
.SH NAME
rdev \- query/set image root device, RAM disk size, or video mode
.SH SYNOPSIS
.nf
.BR "rdev [ \-rvh ] [ \-o " offset " ] [ " image " [ " value " [ " offset " ] ] ]"
.BR "rdev [ \-o " offset " ] [ " image " [ " root_device " [ " offset " ] ] ]"
.BR "ramsize [ \-o " offset " ] [ " image " [ " size " [ " offset " ] ] ]"
.BR "vidmode [ \-o " offset " ] [ " image " [ " mode " [ " offset " ] ] ]"
.BR "rootflags [ \-o " offset " ] [ " image " [ " flags " [ " offset " ] ] ]"
.fi
.SH DESCRIPTION
With no arguments,
.B rdev
outputs an
.I /etc/mtab
line for the current root file system.
With no arguments,
.BR ramsize ", " vidmode ", and " rootflags
print usage information.

In a bootable image for the Linux kernel on i386, there are several pairs
of bytes which specify the root device, the video mode, and the size of
the RAM disk.  These pairs of bytes, by default, begin
at offset 504 (decimal) in the kernel image:

.nf
.RS
 498 Root flags
(500 Reserved)
 502 Unused (was Swap Device)
 504 RAM Disk Size
 506 VGA Mode
 508 Root Device
(510 Boot Signature)
.RE
.fi

.B rdev
will change these values.

Typical values for the
.I image
parameter, which is a bootable Linux kernel image, might be:

.nf
.RS
/vmlinux
/vmunix
/boot/bzImage-2.4.0
/dev/fd0
/dev/fd1
.RE
.fi

When using the
.B rdev
command, the
.I root_device
parameter might be something like:

.nf
.RS
/dev/hda1
/dev/hdf13
/dev/sda2
/dev/sdc4
/dev/ida/c0d0p1
.RE
.fi

One may also specify the device by a comma-separated pair
of decimal integers
.IR major , minor .

For the
.B ramsize
command, the
.B size
parameter specifies the size of the RAM disk in kilobytes.

For the
.B rootflags
command, the
.B flags
parameter contains extra information used when mounting root.
Currently the only effect of these flags is to force the kernel to
mount the root filesystem in readonly mode if 
.B flags
is non-zero.

For the
.B vidmode
command, the
.B mode
parameter specifies the video mode:

.nf
.RS
-3 = Prompt
-2 = Extended VGA
-1 = Normal VGA
 0 = as if "0" was pressed at the prompt
 1 = as if "1" was pressed at the prompt
 2 = as if "2" was pressed at the prompt
 n = as if "n" was pressed at the prompt
.RE
.fi

If the
.I value
is not specified, the
.I image
will be examined to determine the current settings.
.SH OPTIONS
.TP
.B \-r
Causes
.B rdev
to act like
.BR ramsize .
.TP
.B \-R
Causes
.B rdev
to act like
.BR rootflags .
.TP
.B \-v
Causes
.B rdev
to act like
.BR vidmode .
.TP
.B \-h
Provides help.
.SH BUGS
The
.B rdev
utility, when used other than to find a name for the current root device,
is an ancient hack that works by patching a kernel image at a magic offset
with magic numbers. It does not work on architectures other than i386.
Its use is strongly discouraged. Use a boot loader like SysLinux or LILO
instead.
.SH AUTHORS
.nf
Originally by Werner Almesberger (almesber@nessie.cs.id.ethz.ch)
Modified by Peter MacDonald (pmacdona@sanjuan.UVic.CA)
rootflags support added by Stephen Tweedie (sct@dcs.ed.ac.uk)
.fi
